#!/bin/sh

python manage.py makemigrations
python manage.py migrate
python manage.py collectstatic --noinput

# start celery beat
# nohup python manage.py celery beat -l info > ./logs/beat.log 2>&1 &
nohup celery -A FasterRunner beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler --pidfile= > ./logs/beat.log 2>&1 &

# start celery worker
# celery multi start w1 -A FasterRunner -l info --logfile=./logs/worker.log
nohup celery -A FasterRunner worker --pool=solo -l info --logfile=./logs/worker.log >/dev/null 2>&1 &

# start fastrunner
gunicorn FasterRunner.wsgi:application -w 4 -k gthread -b 0.0.0.0:8001 --chdir=/app